package com.ahtcm.tcmlearning.controller;

import com.ahtcm.tcmlearning.utils.HttpUtil;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;


@RestController
public class TestController {

    @RequestMapping("/index")
    public String  index(){
        System.out.println("前后端连接了");
        return "你好,世界";
    }

    /**
     * 获取openid的样例
     */
    @RequestMapping("/getOpenId")
    @ResponseBody
    public  void login(@RequestParam("code") String code){
        String openId = HttpUtil.getOpenId(code);
        //然后对openId进行各种校验
    }



}
